/**
 * Created with JetBrains PhpStorm.
 * User: Artem
 * Date: 06.03.13
 * Time: 14:41
 * To change this template use File | Settings | File Templates.
 */

Ext.define("Pro.view.EmployeesPanel", {
    extend: "Ext.grid.Panel",
    alias: "widget.employeespanel",

    title: "GlobalLogic",
    store: "Employees",
    id: "gridPanel",

    features: [
        {
            ftype: "filters",
            autoReload: false,
            local: true
        }
    ],

    dockedItems: [
        {
            xtype: "pagingtoolbar",
            store: "Employees",
            dock: "top"
        }
    ],

    columns: [
        {
            xtype: "rownumberer"
        },
        {
            header: localization.EMPLOYEES_PANEL_GRID_COLUMN_NAME || "Name",
            dataIndex: "name",
            flex: 1,
            editor: "textfield",
            filter: {
                type: "string"
            }
        },
        {
            header: localization.EMPLOYEES_PANEL_GRID_COLUMN_AGE || "Age",
            dataIndex: "age",
            flex: 1,
            hidden: true,
            editor: "textfield",
            filter: {
                type: "numeric"
            }
        },
        {
            header: localization.EMPLOYEES_PANEL_GRID_COLUMN_PHONE || "Phone",
            dataIndex: "phone",
            flex: 1,
            hidden: true,
            editor: "textfield",
            filter: {
                type: "string"
            }
        },
        {
            xtype: "booleancolumn",
            trueText: "Да",
            falseText: "Нет",
            header: localization.EMPLOYEES_PANEL_GRID_COLUMN_MARRIED || "Married",
            dataIndex: "married",
            flex: 1,
            hidden: true,
            renderer: function(v,m) {
                var color = v ? 'red' : 'green',
                    v=v? 'Да' : 'Нет';
                m.style='color:'+color;
                return v;
            },
            editor: "textfield",
            filter: {
                type: "boolean"
            }
        }
    ]

});